package com.base.cn.platform.os.entity.course.comment;

import com.base.cn.platform.os.common.annotation.ImgAttr;
import com.base.cn.platform.os.common.mybatis.BaseEntity;
import com.base.cn.platform.os.entity.course.catalog.CourseCatalog;
import com.base.cn.platform.os.entity.course.cou.Course;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 课程评价与反馈
 *
 * @author SK
 * @since 2018-06-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class CourseComment extends BaseEntity {
	// 课程ID/套餐ID
	private BigDecimal courseId;
	// 章节id
	private BigDecimal catalogId;
	// 前台用户id
	private BigDecimal userId;
	// 评价与反馈
	@ImgAttr
	private String comment;
	// 课程质量(1~5)
	private Integer quality;
	// 老师讲法(1~5)
	private Integer teach;
	// 综合感受(1~5)
	private Integer feel;
	// 综合评分[三方评分平均](1~5)
	private Integer multiple;

	public void calculateMultiple() {
		this.multiple = Math.round((this.quality + this.teach + this.feel) / 3);
	}

	private Course course;
	private CourseCatalog catalog;
	private Map<String, Object> user;
	//跳转评价页面前是否做验证
	private Boolean before;

}
